import {get, post} from './http'

// index apis
export const getProductList = p => get('product/list', p)


//category
export const getCategoryList = p => get("/category/list", p)
export const getCategoryListForVue = p => get("/category/list/vue", p)
//details
export const getProductDetail = p => get("/product/detail", p)

//cart
export const getCartList = () => get("/cart/list")

export const getCartSize = p => get("/cart/getCartSize", p)

export const addCart = data => post("/cart/add", data)

//login
export const toLogin = data => post("/login", data)

export const toLogout = () => post("/user/logout")
//product
export const productUpdate = data => post("/cart/update", data);

export const productDelete = data => post("/cart/delete", data)

// order
export const createOrder = data => post("/order/create", data)

export const orderList = p => get("/order/list", p)

export const orderDetial = p => get("/order/detail", p)

export const cancelOrder = p => post("/order/cancel", p)

export const payOrder = p => get("/order/qrcode", p)

export const finish = data => post("/order/finish", data)


//echarts
export const getEcharts = () => get("/echarts", {});

//admin
export const getAdminProductList = p => get("/admin/product/list", p)
export const addProduct = data => post("admin/product/add", data)
export const deleteProduct = data => post("admin/product/delete", data)
export const adminCategory = p => get("/admin/category/list", p)
export const adminAddCategory = data => post("/admin/category/add", data)
export const adminDeleteCategory = data => post("/admin/category/delete", data)
export const adminOrderList = p => get("/admin/order/list", p)
export const adminDelivered = data => post("/admin/order/delivered", data)
export const adminFinish = data => post("/order/finish", data)
